import { _decorator } from "cc";
import { LocalizedUIBase } from './LocalizedUIBase';
const { ccclass, property } = _decorator;

export interface ILocalizedGComponent {
    onLanguageChanged(): void;
}

@ccclass('LocalizedGComponent')
export class LocalizedGComponent extends LocalizedUIBase<ILocalizedGComponent> {
    init(obj: ILocalizedGComponent): void {
        super.init(obj);
        if (typeof obj.onLanguageChanged !== "function") {
            console.error(`obj${obj}.onLanguageChanged is not a function`);
        }
    }

    public updateLanguage(): void {
        if (typeof this._obj.onLanguageChanged === "function") {
            this._obj.onLanguageChanged();
        }
    }
}